# $Id: PKGBUILD 86793 2013-03-22 10:03:03Z svenstaro $
# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
# Contributor: Jan de Groot <jgc@archlinux.org>
# Contributor: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: Jacobo Arvelo <unix4all@ya.com>
# Contributor: Douglas Soares de Andrade <douglas@archlinux.org>

pkgname=wesnoth-data
pkgver=1.10.6
pkgrel=1
pkgdesc="A turn-based strategy game on a fantasy world (data files)"
arch=('any')
license=('GPL')
url="http://www.wesnoth.org/"
makedepends=('boost' 'cmake' 'sdl_image' 'sdl_ttf' 'sdl_mixer' 'sdl_net' 'lua' 'pango')
options=(!emptydirs)
source=(http://downloads.sourceforge.net/sourceforge/wesnoth/wesnoth-${pkgver}.tar.bz2)
md5sums=('547e3489bbfa778912b11dbee612c380')

build() {
  cd "${srcdir}/wesnoth-${pkgver}"

  mkdir build && cd build
  cmake .. \
      -DCMAKE_INSTALL_PREFIX=/usr \
      -DENABLE_OMP=ON \
      -DENABLE_TOOLS=ON \
      -DMANDIR=share/man \
      -DFIFO_DIR=/var/run/wesnothd
  make
}

package() {
  cd "${srcdir}/wesnoth-${pkgver}"

  cd build
  make DESTDIR="$pkgdir" install

  rm -r $pkgdir/usr/bin
  rm -r $pkgdir/usr/share/man

  for file in $(grep -l "python" $pkgdir/usr/share/wesnoth/data/tools/*); do
    sed -i "s|#!/usr/bi#n/env python|#!/usr/bin/env python2|" $file;
  done
}
